/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */

package com.haulmont.asu.web;

import com.haulmont.cuba.web.AppUI;
import com.haulmont.cuba.web.AppWindow;
import com.vaadin.ui.HorizontalLayout;

/**
 * Author: Sergey42
 * Date: 30.11.13 11:21
 */
public class UniversityAppWindow extends AppWindow {

    private static final long serialVersionUID = -2123718639866598237L;

    public UniversityAppWindow(AppUI ui) {
        super(ui);
        foldersPane.setVisible(false);
        foldersSplit.setSplitPosition(0.0f);
    }

    @Override
    protected HorizontalLayout createMenuBarLayout() {
        HorizontalLayout layout = new HorizontalLayout();
        layout.setSpacing(false);
        layout.setMargin(false);
        layout.setStyleName("cuba-app-menubar");
        layout.setWidth(100, Unit.PERCENTAGE);
        if (webConfig.getUseLightHeader()) {
            layout.addStyleName("cuba-app-light-header");
            layout.setHeight(40, Unit.PIXELS);
        } else {
            layout.setHeight(28, Unit.PIXELS);
        }

        /*if (webConfig.getUseLightHeader()) {
            Component appIcon = getLogoImage();
            if (appIcon != null) {
                appIcon.setStyleName("cuba-app-icon");
                layout.addComponent(appIcon);
                layout.setComponentAlignment(appIcon, Alignment.MIDDLE_LEFT);
            }
        }*/

        menuBar = createMenuBar();
        layout.addComponent(menuBar);
        placeMenuBar(layout);

        createSearchLayout(layout);

        if (webConfig.getUseLightHeader()) {
            addUserIndicator(layout);

            addNewWindowButton(layout);

            addLogoutButton(layout);
        }

        return layout;
    }


}
